package com.akupilih.app.adapter;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.Log;

import com.akupilih.app.EventFragment;
import com.akupilih.app.JanjiFragment;
import com.akupilih.app.PasanganActivity;
import com.akupilih.app.PeopleTalkChartFragment;
import com.akupilih.app.SocialMediaBarChartFragment;
import com.akupilih.app.VisiMisiFragment;

public class PasanganAdapter extends FragmentPagerAdapter {

	final int PAGE_COUNT = 3;
	private final String[] TITLES = { "Visi Misi", "Kegiatan", "Janji" };
	String capres, cawapres;

	public PasanganAdapter(FragmentManager fragmentManager, String capres,
			String cawapres) {
		super(fragmentManager);
		this.capres = capres;
		this.cawapres = cawapres;
		// TODO Auto-generated constructor stub

	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return PAGE_COUNT;
	}

	@Override
	public CharSequence getPageTitle(int position) {
		// TODO Auto-generated method stub
		return TITLES[position];
	}

	@Override
	public Fragment getItem(int arg0) {
		Bundle data = new Bundle();
		data.putString("capres", capres);
		data.putString("cawapres", cawapres);

		Log.d("bundle-->",  capres);

		switch (arg0) {

		/** tab1 is selected */
		case 0:
			VisiMisiFragment fragment1 = new VisiMisiFragment();
			fragment1.setArguments(data);
			return fragment1;

			/** tab2 is selected */
		case 1:
			EventFragment fragment2 = new EventFragment();
			return fragment2;
		case 2:
			JanjiFragment fragment3 = new JanjiFragment();
			fragment3.setArguments(data);
			return fragment3;
		}
		return null;
	}

}
